﻿package org.njbdqn.commons.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091700530870";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJIP8FIsuoMgouGTSjilU1WwJP7tFJHN1EAziSW+m7eJCL6ANjOqnJOC6bNUabeJsowWMt05ZyA4NzoRI/deLd4pokbPu2ERuawHpA3/nXTHwOpaVMAA5ICzSMd+FDUWRv/83qdmqn2LvEE+Inqo9M/OyTt+Ds+3301imZ+q++Sg+jhuNysrE9UDKhy3Eb5z/RkzLKcN0nYMzRtFccgvGqBXLl98cv+sG5Ea3d0UaXxToaw2T0CJEVUhy0o92gx4SJ3eNg3JAhdMVXUGhAinZL1Z9219O9hYikQU4ynwvTx8ekiB3D0rURY5usWy3PbWE2BuMbRPAfWq1mT3E43n1ZAgMBAAECggEAa+8My34XzsuUN7SfOhon91cq+r9++408m8vtO0YdMvIy0+xKvk/uU/Nku8WzTawgdHPDHM7uG8+oJ9sgAdNIPl2d9g3SEfxlPelCUM36WPxaqSy4bpmcpBgtxGKXa+UkqQMvkNykFnkBUdRUreQR5wctLxgMcnuBKLVpCUnICn4ZwhdogUaaPLvsD020ZrDWKilSjkegCsi9a4pkQX+vGSzvF9MA0j/CRAfixZqMUMXH0jsQTPh44gREwe307W+GHtDgTVGVy0eOlOmZxRaDo2u+0dbjGlvmZdK9iJLwvSSx3GhiFCtLVSfcS1Z1LY64BaNh2/Rx3+eSv+GhFuR2AQKBgQDAgBE0z8pEaKlrC17nMYpmXrFP1/Z7vCE2HKR13/Gl7el+WizzwCOx2mHpaG56ZrZR0QhnlhOzQVwlpvUcDQvaeath8ufoHr3BdoCUODj9CU2bCMOdhK2KXfj6tyiqtrMoy4iIE84L/M/8XyCN6NjG8d7XdMsUGyQP1hKPfnd2QwKBgQC2XQWrVnIifdTzC6fqNhar5TozWJ7+jGVYMdjagfKQN4X/o5ps+qLe8Brt/+FwL2Fdr/0zUnqN+XQvPbV4tObsDn68/egYTdg8lynM0C2KH60CN/nnhqpApetn/evuX6yGtAZDH8DZ/cWPe/wNJC3TVh/otzL2Rxq7OUSomBJ6MwKBgF1fgXkZdWY7UjpPGKiR+izvr5goDDI2rfFecVOP3dn7je+w8+8D+wxw/l9GPZh3q+YBu87rGAEyKe1Fj80ccux1afEn7t9D0g0+Wt4Ka3IpihAybxg/3CGqtXN/VmWAG2UlXMOMv7xG0+f5iIPtNwFBHzNpPnwxMgvQbc5WrMGbAoGAVAVJ3mZG0dNt8MkXBVcEXRCRHyUepCMlclwNEKe8jWu3hk/nj3xu3A5+KdeyE5EQ6Cx0mVfP9WfQew+Qc9vNZUdMZ2EItWHwVgJDlQT5ZmEvwgzuTBkEiiKn8lLQiBR2ld2N4RFZNlaw1moGeDuKDYvpybvWdBfQniBFnPPr13cCgYEAr1q59LsXzlMrJqDufvIascJPmRQh2fJvsf1bAj/gxcp36s1O5eipIdygG5XnR7AOVFmNuizVWV+m9/pV4dLbHFE2p0YwmE5umfZi1iBrqE/uLYyfYQBm/T5dU1LWVqX0b+d/rd+8s8z1H5q8x+bUcggROHzbDJlgOYH/Kg9mGIM=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyO1ZKzxa1FV5znaO1iHIZzWrabPKoTdkXdkNO6nFZyy2kINBhZPpxFeMRDlgDZ0R1HNjQa1sWTITXIBnMOuIc96kxXIL43VowaKa6IRU1r39w8ZAB3EY2aXiX32mL6C6dHPYBmBiCkK3LPbRJe76HwQVFRDtC/j3UwObo9MFirQ1j007VqmFQBDU0B4hbe1UN1p7nfYVA2GVYZMPsw4aGD6REbsdSYUaWZQfmGFOcfo38yne3ysxEwJCKoWawL1VNEGhMT9wl2RbTqiLKoJ4MQYI0QYQ8dpEVaMLe7Zj07fm15DBHAt09WZOaPBjRtjBMp+UvB2N7fi3UosS1ebkBQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://192.168.10.181:8080/qiy/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://192.168.10.131:8888/qiy/paysuccess";
	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

